package com.punai.config.controller.indicatoritem;

import com.punai.common.core.controller.BaseController;
import com.punai.common.core.domain.AjaxResult;
import com.punai.common.core.page.TableDataInfo;
import com.punai.config.service.IndicatorItemService;
import com.punai.config.service.UnitConverService;
import com.punai.config.sqlitedomain.vo.ConfigIndicatorItemVo;
import com.punai.config.sqlitedomain.vo.ConfigUnitConverVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 设置单位转换系数总控制器
 */
@RestController
@RequestMapping("/config/unitConver")
public class ConfigUnitConverController extends BaseController {
    @Autowired
    private UnitConverService unitConverService;
    /**
     * 查询单位转换系数列表
     */
    @PreAuthorize("@ss.hasPermi('config:unitConver:dataList')")
    @GetMapping("/getDataList")
    public TableDataInfo list(ConfigUnitConverVo vo) {
        startPage();
        return unitConverService.getMainTableData(vo);
    }

    /**
     * 查询单位转换系数详情
     * @param vo
     * @return
     */
    @PreAuthorize("@ss.hasPermi('config:unitConver:info')")
    @GetMapping("/getInfo")
    public AjaxResult info(ConfigUnitConverVo vo) {
        ConfigUnitConverVo info = unitConverService.getInfo(vo);
        return AjaxResult.success(info);
    }

    /**
     * 保存单位转换系数
     *
     * @param vo
     * @return
     */
    @PreAuthorize("@ss.hasPermi('config:unitConver:save')")
    @PostMapping("/save")
    public AjaxResult save(ConfigUnitConverVo vo) {
        return AjaxResult.success(unitConverService.save(vo));
    }

    /**
     * 删除单位转换系数
     *
     * @param vo
     * @return
     */
    @PreAuthorize("@ss.hasPermi('config:unitConver:remove')")
    @PostMapping("/remove")
    public AjaxResult remove(ConfigUnitConverVo vo) {
        return AjaxResult.success(unitConverService.remove(vo));
    }

}
